home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
027a
/
ntxmeter.zip
/
NTXMETER.ONG
< prev
next >
Wrap
Text File
|
1989-11-27
|
3KB
|
86 lines
*--------------------------------------------------------------------
* program : ntxmeter.ong
* creator : bernard.ong
* created : 11-24-89
* updated : 11-25-89 -> predetermine last record numeric length
* : 11-27-89 -> speed improvement by taking off macro
* comment : this is a full working UDF that can be implemented in
* your boilerplate library.
*--------------------------------------------------------------------
*
* what is this about ?
*
* this is a short UDF that puts up a moving meter bar on the
* screen as you perform an INDEX ON command. it also im-
* plements a real time numeric counter for the records pro-
* cessed. you can modify the UDF to just use a numeric counter
* or just the moving bar meter if you so desire...
*
* why did i do this ? (advantage is relative)
*
* Zen and aesthetics. some folks want an indication of how far
* an indexing routine is from being done. personally, i think
* it relieves the 'indexing stress' some of us go through.
*
* disadvantage
*
* it's not in assembler or c, so it's real slow. it increases
* your index time by approximately 2.3 times. here are some figures
* on indexing a 4191-record database on a 30 wide character field:
*
* straight indexing 22 seconds
* indexing with numeric counter only 41 seconds
* indexing with moving meter bar only 43 seconds
* indexing with full blown UDF 52 seconds
*
* some comments
*
* i haven't tested this UDF on real large databases. if you find
* a way to speed up the UDF or ran some test results different
* from the above, you could post me a message. in the meantime,
* hope this routine would be useful to anybody who needs it.
* look at sample.prg to see how UDF is being implemented.
*
* acknowledgement
*
* thanks to GARY DOUGLAS PINDER for his numeric counter routine
* for indexing. his routine is arced under file ODOMET.ARC.
*
* BERNARD ONG (73667,1516)
*
*--------------------------------------------------------------------
function ntxmeter
parameters keyer,_meterline
private keyer,_meterline,_percent
if .not. eof()
if (empty(indexkey(indexord()))) .and. (empty(indexkey(1)))
* numeric counter number
@ _meterline-02,30 say str(recno(),len(ltrim(str(lastrec()))))
* moving meter bar routine
_percent = recno()/lastrec()*60
@ _meterline,10 say replicate('█',_percent)
endif
endif
return keyer
*
*--------------------------------------------------------------------
function meterbox
parameters boxline
private boxline,length
* draw meter borders and labels
@ boxline-01,09 to boxline+1,70
@ boxline+02,09 say '0%'
@ boxline+02,67 say '100%'
@ boxline+00,10 say replicate('░',60)
length = len(ltrim(str(lastrec())))
@ boxline-02,10 say 'Records Completed : '+space(length)+'/'+ltrim(str(lastrec()))
return ''
*
*
* eof: ntxmeter.ong